package mapping

import (
  "ota/model"
  "ota/model/entity"
)

// UpgradePlansEntityToDto entity data transfer
func UpgradePlansEntityToDto(upgradePlans []*entity.UpgradePlan) []*model.UpgradePlanInfo {
  out := make([]*model.UpgradePlanInfo, 0, len(upgradePlans))
  for _, c := range upgradePlans {
    out = append(out, UpgradePlanEntityToDto(c))
  }
  return out
}

// UpgradePlanEntityToDto entity data transfer
func UpgradePlanEntityToDto(e *entity.UpgradePlan) *model.UpgradePlanInfo {
  return &model.UpgradePlanInfo{

    Id: e.Id,

    StrategyId: e.StrategyId,

    Name: e.Name,

    Detail: e.Detail,

    TargetType: e.TargetType,
    
    UpgradeType: e.UpgradeType,

    QueryCond: e.QueryCond,

    StartTime: e.StartTime,

    FailureCount: e.FailureCount,

    SuccessCount: e.SuccessCount,

    TotalCount: e.TotalCount,

    Status: e.Status,

    Overseer: e.Overseer,

    Tester: e.Tester,

    Inspector: e.Inspector,

    Operator: e.Operator,

    OperatorName: e.OperatorName,

    CreatedAt: e.CreatedAt,

    UpdatedAt: e.UpdatedAt,
  }
}
